1. Przygotowanie bibliotek do pracy
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
## corrplot 0.84 loaded
## Loading required package: lattice
## randomForest 4.6-14
## Type rfNews() to see new features/changes/bug fixes.
## 
## Attaching package: 'randomForest'
## The following object is masked from 'package:gridExtra':
## 
##     combine
## The following object is masked from 'package:ggplot2':
## 
##     margin
## The following object is masked from 'package:dplyr':
## 
##     combine
  1. Ładowanie oraz struktura danych
## 'data.frame':    52582 obs. of  16 variables:
##  $ X     : int  0 1 2 3 4 5 6 7 8 9 ...
##  $ length: num  23 22.5 25 25.5 24 22 24 23.5 22.5 22.5 ...
##  $ cfin1 : Factor w/ 40 levels "?","0","0.01",..: 5 5 5 5 5 5 5 5 5 5 ...
##  $ cfin2 : Factor w/ 49 levels "?","0","0.01",..: 14 14 14 14 14 14 14 14 14 14 ...
##  $ chel1 : Factor w/ 49 levels "?","0","0.2287",..: 20 20 20 20 20 20 20 20 20 20 ...
##  $ chel2 : Factor w/ 52 levels "?","10.10963",..: 1 23 23 23 23 23 23 23 23 23 ...
##  $ lcop1 : Factor w/ 49 levels "?","0.30741",..: 20 20 20 20 20 20 20 20 20 20 ...
##  $ lcop2 : Factor w/ 52 levels "?","10.72889",..: 23 23 23 23 23 1 23 23 23 23 ...
##  $ fbar  : num  0.356 0.356 0.356 0.356 0.356 0.356 0.356 0.356 0.356 0.356 ...
##  $ recr  : int  482831 482831 482831 482831 482831 482831 482831 482831 482831 482831 ...
##  $ cumf  : num  0.306 0.306 0.306 0.306 0.306 ...
##  $ totaln: num  267381 267381 267381 267381 267381 ...
##  $ sst   : Factor w/ 52 levels "?","12.7690663857",..: 38 38 38 38 38 38 38 38 38 38 ...
##  $ sal   : num  35.5 35.5 35.5 35.5 35.5 ...
##  $ xmonth: int  7 7 7 7 7 7 7 7 7 7 ...
##  $ nao   : num  2.8 2.8 2.8 2.8 2.8 2.8 2.8 2.8 2.8 2.8 ...

Zbiór danych zawiera 52582 obserwacje opisane 15 atrybutami: length: długość złowionego śledzia [cm] cfin1: dostępność planktonu [zagęszczenie Calanus finmarchicus gat. 1] cfin2: dostępność planktonu [zagęszczenie Calanus finmarchicus gat. 2] chel1: dostępność planktonu [zagęszczenie Calanus helgolandicus gat. 1] chel2: dostępność planktonu [zagęszczenie Calanus helgolandicus gat. 2] lcop1: dostępność planktonu [zagęszczenie widłonogów gat. 1] lcop2: dostępność planktonu [zagęszczenie widłonogów gat. 2] fbar: natężenie połowów w regionie [ułamek pozostawionego narybku] recr: roczny narybek [liczba śledzi] cumf: łączne roczne natężenie połowów w regionie [ułamek pozostawionego narybku] totaln: łączna liczba ryb złowionych w ramach połowu [liczba śledzi] sst: temperatura przy powierzchni wody [°C] sal: poziom zasolenia wody [Knudsen ppt] xmonth: miesiąc połowu [numer miesiąca] nao: oscylacja północnoatlantycka [mb]

  1. Zamiana atrybutów “?” na wartości N/A

  2. Zmiana typów zmiennych Zmiana typów zmiennych ułatwi czyszczenie danych oraz późniejszą analizę.

  3. Analiza rozkładu atrybutów

##      length         cfin1             cfin2             chel1       
##  Min.   :19.0   Min.   : 0.0000   Min.   : 0.0000   Min.   : 0.000  
##  1st Qu.:24.0   1st Qu.: 0.0000   1st Qu.: 0.2778   1st Qu.: 2.469  
##  Median :25.5   Median : 0.1111   Median : 0.7012   Median : 5.750  
##  Mean   :25.3   Mean   : 0.4458   Mean   : 2.0248   Mean   :10.006  
##  3rd Qu.:26.5   3rd Qu.: 0.3333   3rd Qu.: 1.7936   3rd Qu.:11.500  
##  Max.   :32.5   Max.   :37.6667   Max.   :19.3958   Max.   :75.000  
##                 NA's   :1581      NA's   :1536      NA's   :1555    
##      chel2            lcop1              lcop2             fbar       
##  Min.   : 5.238   Min.   :  0.3074   Min.   : 7.849   Min.   :0.0680  
##  1st Qu.:13.427   1st Qu.:  2.5479   1st Qu.:17.808   1st Qu.:0.2270  
##  Median :21.673   Median :  7.0000   Median :24.859   Median :0.3320  
##  Mean   :21.221   Mean   : 12.8108   Mean   :28.419   Mean   :0.3304  
##  3rd Qu.:27.193   3rd Qu.: 21.2315   3rd Qu.:37.232   3rd Qu.:0.4560  
##  Max.   :57.706   Max.   :115.5833   Max.   :68.736   Max.   :0.8490  
##  NA's   :1556     NA's   :1653       NA's   :1591                     
##       recr              cumf             totaln             sst       
##  Min.   : 140515   Min.   :0.06833   Min.   : 144137   Min.   :12.77  
##  1st Qu.: 360061   1st Qu.:0.14809   1st Qu.: 306068   1st Qu.:13.60  
##  Median : 421391   Median :0.23191   Median : 539558   Median :13.86  
##  Mean   : 520367   Mean   :0.22981   Mean   : 514973   Mean   :13.87  
##  3rd Qu.: 724151   3rd Qu.:0.29803   3rd Qu.: 730351   3rd Qu.:14.16  
##  Max.   :1565890   Max.   :0.39801   Max.   :1015595   Max.   :14.73  
##                                                        NA's   :1584   
##       sal            xmonth            nao          
##  Min.   :35.40   Min.   : 1.000   Min.   :-4.89000  
##  1st Qu.:35.51   1st Qu.: 5.000   1st Qu.:-1.89000  
##  Median :35.51   Median : 8.000   Median : 0.20000  
##  Mean   :35.51   Mean   : 7.258   Mean   :-0.09236  
##  3rd Qu.:35.52   3rd Qu.: 9.000   3rd Qu.: 1.63000  
##  Max.   :35.61   Max.   :12.000   Max.   : 5.08000  
## 
  1. Wielkość zbioru i wartości puste

Zbiór danych opisujący połów śledzi zawiera ponad 10 tys. niepełnych obserwacji. Całkowity zbiór składa się z ponad 52 tys. pomiarów. Pomijając prawie 20% danych zostałyby utracone istotne informacje.

Na podstawie podsumowania statystyki załadowanego pliku można zauważyć, że brakujące dane występują jedynie w atrybutach opisujących:

W zbiorze danych można zwrócić uwagę, że wartości atrybutów występują w podobnych grupach. Dla przedstawienia tej tezy wybrałem przykładowe trzy podzbiory sąsiadujących ze sobą elementów:

##           X length   cfin1    cfin2    chel1    chel2    lcop1    lcop2
## 1         0   23.0 0.02778  0.27785  2.46875       NA  2.54787 26.35881
## 2         1   22.5 0.02778  0.27785  2.46875 21.43548  2.54787 26.35881
## 3         2   25.0 0.02778  0.27785  2.46875 21.43548  2.54787 26.35881
## 4         3   25.5 0.02778  0.27785  2.46875 21.43548  2.54787 26.35881
## 5         4   24.0 0.02778  0.27785  2.46875 21.43548  2.54787 26.35881
## 1001   1000   26.5 2.14333  0.29600  6.38667 21.67333  9.01000 24.85867
## 1002   1001   25.0 2.14333  0.29600  6.38667 21.67333  9.01000 24.85867
## 1003   1002   25.5 2.14333  0.29600  6.38667 21.67333  9.01000 24.85867
## 1004   1003   23.5 2.14333  0.29600  6.38667 21.67333       NA 24.85867
## 1005   1004   24.5 2.14333  4.45882  6.38667 26.17187  9.01000 32.19090
## 20001 20000   26.0 0.20536 19.39583       NA 32.64940 11.77679 65.51964
## 20002 20001   28.0 0.20536 19.39583 11.24554 32.64940 11.77679 65.51964
## 20003 20002   26.0 0.20536 19.39583 11.24554 32.64940 11.77679 65.51964
## 20004 20003   25.5 0.20536 19.39583 11.24554 32.64940 11.77679 65.51964
## 20005 20004   23.5 0.20536 19.39583 11.24554 32.64940 11.77679 65.51964
##        fbar   recr      cumf   totaln      sst      sal xmonth   nao
## 1     0.356 482831 0.3059879 267380.8 14.30693 35.51234      7  2.80
## 2     0.356 482831 0.3059879 267380.8 14.30693 35.51234      7  2.80
## 3     0.356 482831 0.3059879 267380.8 14.30693 35.51234      7  2.80
## 4     0.356 482831 0.3059879 267380.8 14.30693 35.51234      7  2.80
## 5     0.356 482831 0.3059879 267380.8 14.30693 35.51234      7  2.80
## 1001  0.158 392084 0.1100757 766077.6 14.06933 35.51526      5 -1.54
## 1002  0.158 392084 0.1100757 766077.6 14.06933 35.51526      5 -1.54
## 1003  0.158 392084 0.1100757 766077.6 14.06933 35.51526      5 -1.54
## 1004  0.158 392084 0.1100757 766077.6 14.06933 35.51526      5 -1.54
## 1005  0.327 783337 0.3096315 492519.0 13.98133 35.61240     10  0.80
## 20001 0.467 168531 0.3854825 201854.9 13.19707 35.47843     12 -2.25
## 20002 0.467 168531 0.3854825 201854.9 13.19707 35.47843     12 -2.25
## 20003 0.467 168531 0.3854825 201854.9 13.19707 35.47843     12 -2.25
## 20004 0.467 168531 0.3854825 201854.9 13.19707 35.47843     12 -2.25
## 20005 0.467 168531 0.3854825 201854.9 13.19707 35.47843     12 -2.25
  1. Uzupełnianie wartości pustych

Po zamianie pustych wartości na podobne, podsumowanie zbioru danych wygląda następujaco:

##      length         cfin1             cfin2             chel1       
##  Min.   :19.0   Min.   : 0.0000   Min.   : 0.0000   Min.   : 0.000  
##  1st Qu.:24.0   1st Qu.: 0.0000   1st Qu.: 0.2778   1st Qu.: 2.469  
##  Median :25.5   Median : 0.1111   Median : 0.7012   Median : 5.750  
##  Mean   :25.3   Mean   : 0.4462   Mean   : 2.0261   Mean   :10.003  
##  3rd Qu.:26.5   3rd Qu.: 0.3333   3rd Qu.: 1.7936   3rd Qu.:11.500  
##  Max.   :32.5   Max.   :37.6667   Max.   :19.3958   Max.   :75.000  
##      chel2            lcop1              lcop2             fbar       
##  Min.   : 5.238   Min.   :  0.3074   Min.   : 7.849   Min.   :0.0680  
##  1st Qu.:13.427   1st Qu.:  2.5479   1st Qu.:17.808   1st Qu.:0.2270  
##  Median :21.435   Median :  7.0000   Median :24.859   Median :0.3320  
##  Mean   :21.218   Mean   : 12.8053   Mean   :28.423   Mean   :0.3304  
##  3rd Qu.:27.193   3rd Qu.: 21.2315   3rd Qu.:37.232   3rd Qu.:0.4560  
##  Max.   :57.706   Max.   :115.5833   Max.   :68.736   Max.   :0.8490  
##       recr              cumf             totaln             sst       
##  Min.   : 140515   Min.   :0.06833   Min.   : 144137   Min.   :12.77  
##  1st Qu.: 360061   1st Qu.:0.14809   1st Qu.: 306068   1st Qu.:13.60  
##  Median : 421391   Median :0.23191   Median : 539558   Median :13.86  
##  Mean   : 520367   Mean   :0.22981   Mean   : 514973   Mean   :13.88  
##  3rd Qu.: 724151   3rd Qu.:0.29803   3rd Qu.: 730351   3rd Qu.:14.16  
##  Max.   :1565890   Max.   :0.39801   Max.   :1015595   Max.   :14.73  
##       sal            xmonth            nao          
##  Min.   :35.40   Min.   : 1.000   Min.   :-4.89000  
##  1st Qu.:35.51   1st Qu.: 5.000   1st Qu.:-1.89000  
##  Median :35.51   Median : 8.000   Median : 0.20000  
##  Mean   :35.51   Mean   : 7.258   Mean   :-0.09236  
##  3rd Qu.:35.52   3rd Qu.: 9.000   3rd Qu.: 1.63000  
##  Max.   :35.61   Max.   :12.000   Max.   : 5.08000
  1. Normalizacja danych W celu znormalizowania danych dzielimy cały obszar na zbiór uczacy i treningowy. Aby tego dokonać, korzystam z biblioteki caret i określam parametr stratyfikacji (w naszym podejściu długość śledzia - length), procent w ziorze uczącym (75%) oraz “wymuszę” indeksy zamiast listy.
set.seed(23)
inTraining <- createDataPartition(
    y = sledzie$length,
    p = .75,
    list = FALSE)
sledzieTraining <- sledzie[inTraining, ]
sledzieTest <- sledzie[-inTraining, ]
  1. Analiza atrybutów zbioru danych
ggplot(sledzie,aes(x=length)) + geom_histogram(colour = "red") + ggtitle("Długość śledzia")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Dostępność planktonu [zagęszczenie Calanus finmarchicus gat. 1]

ggplot(sledzie,aes(x=cfin1)) + geom_histogram(colour = "yellow") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Dostępność planktonu")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Dostepność planktonu[zagęszczenie Calanus finmarchicus gat. 2]

ggplot(sledzie,aes(x=cfin2)) + geom_histogram(colour = "green") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Dostępność planktonu")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Dostępnosc planktonu [zageszczenie Calanus helgolandicus gat. 1]

ggplot(sledzie,aes(x=chel1))+geom_histogram(colour = "yellow") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Dostępność planktonu")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Dostępność planktonu [zagęszczenie Calanus helgolandicus gat. 2]

ggplot(sledzie,aes(x=chel2))+geom_histogram(colour = "green") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Dostępność planktonu")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Dostępność planktonu [zagęszczenie widłonogów gat. 1]

ggplot(sledzie,aes(x=lcop1))+geom_histogram(colour = "red") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Dostępność planktonu")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Dostępność planktonu [zagęszczenie widłonogów gat. 2]

ggplot(sledzie,aes(x=lcop2))+geom_histogram(colour = "black") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Dostępność planktonu")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Natężenie połowów w regionie [ułamek pozostawionego narybku]

ggplot(sledzie,aes(x=fbar))+geom_histogram(colour = "green") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Natezenie polowów w regionie")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Roczny narybek [Liczba śledzi]

ggplot(sledzie,aes(x=recr))+geom_histogram(colour = "yellow") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Roczny narybek")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Łączne roczne natężenie połowów w regionie [ułamek pozostawionego narybku]

ggplot(sledzie,aes(x=cumf))+geom_histogram(colour = "blue") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Łączne roczne natężenie połowów w regionie")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Łączna liczba ryb złowionych w ramach połowu [liczba śledzi]

ggplot(sledzie,aes(x=totaln))+geom_histogram(colour = "red") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Łączna liczba ryb złowionych w ramach połowu")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Temperatura przy powierzchni wody [°C]

ggplot(sledzie,aes(x=sst))+geom_histogram(colour = "blue") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Temperatura [°C]")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Poziom zasolenia wody [Knudsen ppt]

ggplot(sledzie,aes(x=sal))+geom_histogram(colour = "yellow") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Poziom zasolenia wody")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

- Oscylacja pólnocnoatlantycka [mb]

ggplot(sledzie,aes(x=nao))+geom_histogram(colour = "red")+theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ggtitle("Oscylacja pólnocnoatlantycka")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

10. Zmiana długości śledzia w czasie.

Zakładając, że dane sa poukładane chronologicznie to wykres zmiany długości w czasie będzie wygladał następująco:

r <- ggplot(sledzie, aes(x = X, y=length)) + geom_point() + geom_smooth(method="auto", se=TRUE, color="yellow") + ggtitle("Zmiana długości śledzia w czasie")
ggplotly(r)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
## `geom_smooth()` using method = 'gam'

Natomiast jeżeli dane nie są posortowane chronologicznie mozna je pogrupować po wartości zmiennej recr, która przedstawia roczny połów a więc przedstawia poszczególne lata.

sledzieGrupowane <- sledzie%>%group_by(recr)%>%summarize(mean=mean(length))
plot_ly(sledzieGrupowane, y = ~mean, name = 'zmiana długości w czasie', type = 'scatter', mode = 'lines') 

Jak pokazuje powyzszy wykres, oba przypadki są podobne. Ciekawą analiza porównawczą jest sprawdzenie jak wielkość ryb kształtowala się w poszczególnych miesiącach:

sledzieGrupowaneMiesiac <- sledzie%>%group_by(xmonth)%>%summarize(mean=mean(length))
ggplot(sledzieGrupowaneMiesiac, aes(x = xmonth, y = mean))+ geom_point() + geom_smooth(method="auto", se=TRUE, color="red") + ggtitle("Długość śledzia miesięcznie")
## `geom_smooth()` using method = 'loess'

Aby poszerzyć pogląd na dane, można zobaczyć jak kształtowały się wartości zmiennych w poszczególnych latach (średnie wartości zmiennych dla poszczególnych wartosci zmiennej recr):

z <- sledzie%>%group_by(recr)%>%summarize(mean_cfin1 = mean(cfin1), mean_cfin2 = mean(cfin2), mean_chel1 = mean(chel1), mean_chel2 = mean(chel2), mean_lcop1 = mean(lcop1), mean_lcop2 = mean(lcop2), mean_fbar = mean(fbar), mean_cum = mean(cumf), mean_totaln = mean(totaln), mean_sst = mean(sst), mean_sal = mean(sal), mean_nao = mean(nao))
head(z,length(z$recr))
## # A tibble: 52 x 13
##       recr mean_cfin1 mean_cfin2 mean_chel1 mean_chel2 mean_lcop1
##      <dbl>      <dbl>      <dbl>      <dbl>      <dbl>      <dbl>
##  1 140515.   0.000249     1.79         3.71       31.4       3.91
##  2 148045.   0.           0.727        2.59       33.1       5.35
##  3 163005.   0.218        0.578        3.20       20.2       4.26
##  4 168531.   0.205       19.4         11.2        32.6      11.8 
##  5 186562.   0.101        0.           5.10       15.3       5.72
##  6 204165.   0.0876       0.0256       7.89       33.5       9.02
##  7 208551.   0.184        2.00         1.92       17.9       2.19
##  8 227463.   0.100        0.371        3.88       25.8       5.19
##  9 247178.   0.0400       0.805        6.53       18.6       6.75
## 10 254830.   0.           0.922       75.0        30.4      75.0 
## # ... with 42 more rows, and 7 more variables: mean_lcop2 <dbl>,
## #   mean_fbar <dbl>, mean_cum <dbl>, mean_totaln <dbl>, mean_sst <dbl>,
## #   mean_sal <dbl>, mean_nao <dbl>
  1. Korelacja atrybutów
korel <- round(cor(sledzie%>%select(length,cfin1,cfin2,chel1,chel2,lcop1,lcop2,fbar,recr,cumf,totaln,sst,sal,nao)),2)
korel
##        length cfin1 cfin2 chel1 chel2 lcop1 lcop2  fbar  recr  cumf totaln
## length   1.00  0.08  0.10  0.22 -0.01  0.24  0.05  0.25 -0.01  0.01   0.10
## cfin1    0.08  1.00  0.15  0.09  0.20  0.12  0.21 -0.06  0.12 -0.05   0.13
## cfin2    0.10  0.15  1.00  0.00  0.31 -0.04  0.65  0.15 -0.10  0.34  -0.22
## chel1    0.22  0.09  0.00  1.00  0.29  0.96  0.25  0.16 -0.05  0.07   0.17
## chel2   -0.01  0.20  0.31  0.29  1.00  0.18  0.88  0.03  0.00  0.26  -0.38
## lcop1    0.24  0.12 -0.04  0.96  0.18  1.00  0.15  0.10  0.00 -0.01   0.27
## lcop2    0.05  0.21  0.65  0.25  0.88  0.15  1.00  0.05  0.00  0.29  -0.30
## fbar     0.25 -0.06  0.15  0.16  0.03  0.10  0.05  1.00 -0.24  0.82  -0.51
## recr    -0.01  0.12 -0.10 -0.05  0.00  0.00  0.00 -0.24  1.00 -0.26   0.37
## cumf     0.01 -0.05  0.34  0.07  0.26 -0.01  0.29  0.82 -0.26  1.00  -0.71
## totaln   0.10  0.13 -0.22  0.17 -0.38  0.27 -0.30 -0.51  0.37 -0.71   1.00
## sst     -0.45  0.01 -0.24 -0.22  0.01 -0.26 -0.12 -0.18 -0.20  0.03  -0.29
## sal      0.03  0.13 -0.08 -0.15 -0.22 -0.10 -0.18  0.04  0.28 -0.10   0.15
## nao     -0.26  0.01 -0.01 -0.51 -0.06 -0.55 -0.04  0.07  0.09  0.23  -0.39
##          sst   sal   nao
## length -0.45  0.03 -0.26
## cfin1   0.01  0.13  0.01
## cfin2  -0.24 -0.08 -0.01
## chel1  -0.22 -0.15 -0.51
## chel2   0.01 -0.22 -0.06
## lcop1  -0.26 -0.10 -0.55
## lcop2  -0.12 -0.18 -0.04
## fbar   -0.18  0.04  0.07
## recr   -0.20  0.28  0.09
## cumf    0.03 -0.10  0.23
## totaln -0.29  0.15 -0.39
## sst     1.00  0.01  0.51
## sal     0.01  1.00  0.13
## nao     0.51  0.13  1.00
corrplot(korel, method = "square")

Z analizy wizualizacji oraz tabeli korelacji widać, że są cztery pary skorelowanych ze soba zmiennych : Pierwsza para skorelowana dodatnio: lcop1 - chel1

ggplot(sledzie,aes(x=lcop1,y=chel1)) + geom_point(colour = "green") + ggtitle("Korelacja lcop1 i chel1")

Dostępność planktonu [zagęszczenie widłonogów gat. 1] - lcop1 jest zależna od dostępności planktonu [zagęszczenie Calanus helgolandicus gat. 1] - chel1

Druga para skorelowana dodatnio: lcop2 - chel2

ggplot(sledzie,aes(x=lcop2,y=chel2)) + geom_point(colour = "yellow") + ggtitle("Korelacja lcop2 i chel2")

Dostępność planktonu [zagęszczenie widłonogów gat. 2] - lcop2 jest zależna od dostępności planktonu [zagęszczenie Calanus helgolandicus gat. 2] - chel2

Trzecia para skorelowana dodatnio: fbar - cumf

ggplot(sledzie,aes(x=fbar,y=cumf))+geom_point(colour = "blue") + ggtitle("Korelacja fbar i cumf")

Łączne roczne natężenie połowów w regionie [ułamek pozostawionego narybku] - cumf zależy od natężenia połowów w regionie [ułamek pozostawionego narybku] - fbar

Wszystkie wyżej wymienione skorelowane pary są silnie ze sobą powiązane ale ich zależności są oczywiste. Ponieważ badamy długość śledzia i jej zmianę, skupię się na badaniu korelacji atrybutu lenght. Z wizualizacji widać, ze atrybut ten skorelowany jest z dostępnością planktonu [zagęszczenie Calanus helgolandicus gat. 1] - chel1, dostępnością planktonu [zagęszczenie widłonogów gat. 1] - lcop1 oraz natężeniem połowów w regionie [ułamek pozostawionego narybku] - fbar.

ggplot(sledzie, aes(x=chel1, y=length)) + geom_point() + ggtitle("Korelacja parametrów length")

ggplot(sledzie, aes(x=lcop1, y=length)) + geom_point() + ggtitle("Korelacja parametrów length")

Jak widać długość śledzia zależy przede wszystkim od zagęszczenia charakterystycznego planktonu.